﻿/// -----------------------------------------------------------------------
/// (c) 2009 Microsoft Corporation -- All rights reserved
/// This code is licensed under the MS-PL
/// http://www.opensource.org/licenses/ms-pl.html
/// Courtesy of the Open Source Techology Center: http://port25.technet.com
/// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using gsToolkit;
using System.Runtime.InteropServices;

namespace ToolkitTests {

    [ComVisible(true)]    
    public class Program {
        static void Main(string[] args) {
            // new Program().go();
            new Program().goTestEXE();
        }

        public void go() {
            ScriptHost host= new ScriptHost(ScriptLanguage.JScript);
            host.GlobalMembers.Add("x" , this);
            host.ScriptText = @"
function Sample() {
    WScript.echo(""hi"");
    x.print(""there""); // this is from the global added above, which is the instance of this class!
}

function Sample2(v) {
    WScript.echo(""v=""+v);
    x.print(""there""); // this is from the global added above, which is the instance of this class!
}

";


            host.Run();
            host.Invoke("Sample");
            host.Invoke("Sample2", 100);

            Console.ReadLine();
        }

        public void goTestEXE() {
            ExecutableInfo info = ProgramFinder.GetExeType(@"C:\root\tmp\detours-bug\Test64bit\Test64bit\bin\Release\Test64bit.exe");
        }

        public void print(string txt) {
            Console.WriteLine(txt);
        }
    }
}
